package com.cat.slidingWindow;

/**
*   @description https://leetcode.cn/problems/make-string-a-subsequence-using-cyclic-increments/
*   @author 曲大人的喵
*   @create 2025/9/18 19:30
*   @since JDK17
*/

public class Solution44 {
    boolean judge(char a, char b) {
        return  a == b || (a == 'z' && b == 'a' || a + 1 == b);
    }
    public boolean canMakeSubsequence(String str1, String str2) {
        int n = str1.length(), m = str2.length(), i, j;
        for (i = j = 0; i < n && j < m; i++) {
            if (judge(str1.charAt(i), str2.charAt(j))) {
                j++;
            }
        }

        return j == m;
    }
}
